<?php
/* @var $this QuotationOrderHeaderNewController */
/* @var $model QuotationOrderHeader */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
    'id'=>'quotation-order-header-form',
    // Please note: When you enable ajax validation, make sure the corresponding
    // controller action is handling ajax validation correctly.
    // There is a call to performAjaxValidation() commented in generated controller code.
    // See class documentation of CActiveForm for details on this.
    'enableAjaxValidation'=>false,
)); ?>

    <p class="note">Fields with <span class="required">*</span> are required.</p>

    <?php echo $form->errorSummary($model); ?>

    <div class="row">
        <?php echo $form->labelEx($model,'quotation_no'); ?>
        <?php echo $form->textField($model,'quotation_no',array('id'=>'quotation_no','value'=>$quo_no,'readonly'=>'readonly','size'=>50,'maxlength'=>50)); ?>
        <?php // echo $form->error($model,'quotation_no'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'customer'); ?>
        <?php echo $form->textField($model,'customer_name',array('id'=>'customer_name','size'=>40,'maxlength'=>40,'readonly'=>'readonly'));
         ?>
        <?php 
            if($model->customer_name=='')
                echo CHtml::button('Select Customer',array('id'=>'selectCust','onclick'=>"{ location.reload();}")); 
        ?>
        <?php //echo $form->error($model,'customer'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'attention'); ?>
        <?php echo $form->textField($model,'attention',array('id'=>'attention','size'=>40,'maxlength'=>40)); ?>
        <?php //echo $form->error($model,'attention'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'project'); ?>
        <?php echo $form->textField($model,'project',array('size'=>20,'maxlength'=>20)); ?>
        <?php //echo $form->error($model,'project'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'reff'); ?>
        <?php echo $form->textField($model,'reff',array('size'=>40,'maxlength'=>40)); ?>
        <?php //echo $form->error($model,'reff'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'date'); ?>
        <?php //echo $form->textField($model,'date',array()); ?>
        <?php
        $this->widget('zii.widgets.jui.CJuiDatePicker',
              array(
                  'attribute'=>'date',
                  'language'=>'en',
                  'model'=>$model,
                  'options'=>array('mode'=>'focus',
                                   'dateFormat'=>'yy-mm-dd',
                                   'showAnim'=>'slideDown',),
                  'htmlOptions'=>array('size'=>'30','class'=>'date'),));

        ?>
        <?php //echo $form->error($model,'date'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'currency'); ?>
        <?php echo $form->dropDownList($model,'currency',array('USD'=>'USD','IDR'=>'IDR')); ?>
        <?php //echo $form->error($model,'currency'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'discount'); ?>
        <?php echo $form->numberField($model,'discount',array('value'=>0,'min'=>0,'max'=>100)); ?>
        <?php //echo $form->error($model,'discount'); ?>
    </div>

    

    <div class="row">
        <?php echo $form->labelEx($model,'delivery'); ?>
        <?php echo $form->textField($model,'delivery',array('value'=>'8-10 weeks','maxlength'=>49)); ?>
        <?php //echo $form->error($model,'delivery'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'payment'); ?>
        <?php /*$this->widget('ext.combobox.EJuiComboBox', array(
                    'model' => $model,
                    'attribute' => 'payment',
                    'assoc'=>false,
                    //'name'=>'payment',
                    // data to populate the select. Must be an array.
                    'data' => array(
                            '50% DP. Balance before delivery',
                            '100% cash in advance',
                            '30% DP. Balance before delivery'
                            ),
                    // options passed to plugin
                    'options' => array(
                        // JS code to execute on 'select' event, the selected item is
                        // available through the 'item' variable.
                        //'onSelect' => 'alert("selected value : " + item.value);',
                        // JS code to be executed on 'change' event, the input is available
                        // through the '$(this)' variable.
                        //'onChange' => 'alert("changed value : " + $(this).val());',
                        // If false, field value must be present in the select.
                        // Defaults to true.
                        'allowText' => true,
                    ),
                    // Options passed to the text input
                    'htmlOptions' => array('size' => 10),
                ));*/ 
                $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
                        'model'=>$model,
                        'attribute'=>'payment',
                        //'id'=>'customerPick',
                        //'name'=>'customer',
                        //'source'=>$this->createUrl('quotationOrderHeader/suggestCountry'),
                        'source'=>array(
                                    '50% DP. Balance before delivery',
                                    '100% cash in advance',
                                    '30% DP. Balance before delivery'
                                  ),
                        'htmlOptions'=>array(
                            //'size'=>'40',
                            'select'=>"js:function(event, ui) { 
                               // $('#tempIdCust').val(); 
                            }"
                        ),
                        'options'=>array(
                            'minLength'=>'0',
                        ),
                    ));


                ?>
        <?php //echo $form->error($model,'payment'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'validity'); ?>
        <?php echo $form->dropDownList($model,'validity',
            array(
                '30'=>'30 days',
                '60'=>'60 days',
                '90'=>'90 days',
                '120'=>'120 days',
          )); ?>
        <?php //echo $form->error($model,'validity'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model,'remarks'); ?>
        <?php echo $form->textField($model,'remarks',array('value'=>'-','maxlength'=>40)); ?>
        <?php //echo $form->error($model,'remarks'); ?>
    </div>

    

    <div class="row buttons">
        <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
    </div>

<?php $this->endWidget(); ?>

</div><!-- form -->